<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" ;>

    <head>
        <meta charset="UTF-8">
        <title>派车记录</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <!--<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />-->

        <link rel="stylesheet" href="../../static/css/font.css">
        <link rel="stylesheet" href="../../static/css/xadmin.css">
        <script src="../../static/lib/layui/layui.js"></script>
        <script src="../../static/js/xadmin.js"></script>
        <script src="../../static/js/jquery.min.js"></script>
        <script type="text/javascript">

            $(function () {

                $('#js-export').click(function(){
                    window.location.href="/paicheExport";
                });

                $('#button').click(function(){
                    var form=$("#form").serialize();
                        $.ajax({
                            url:"/selectRecords",
                            type:'GET',
                            data:form,
                            //dataType:"text",
                            async: false,
                            success: function(data) {
                                if(data.code===20007){
                                    alert(data.message);
                                    $("#tab").html('');
                                }else{
                                    var u = data.data;
                                    $("#tab").html('');
                                    for (var i = 0; i < u.length; i++) {
                                        if(u[i]. comMander==null){
                                            u[i]. comMander='';
                                        }
                                        if(u[i]. auditLeaderShip==null){
                                            u[i]. auditLeaderShip='';
                                        }
                                        s = "<tr>" +
                                            "   <td>" + u[i].paicheno + "</td>" +
                                            "   <td>" + u[i]. paichedate+ "</td>" +
                                            "   <td>" + u[i].department+ "</td>" +
                                            "   <td>" + u[i]. useMan+ "</td>" +
                                            "   <td>" + u[i].cause + "</td>" +
                                            "   <td>" + u[i].man + "</td>" +
                                            "   <td>" + u[i].weight + "</td>" +
                                            "   <td>" + u[i]. destination+ "</td> " +
                                            "   <td>" + u[i]. carNo+ "</td> " +
                                            "   <td>" + u[i]. carType+ "</td> " +
                                            "   <td>" + u[i]. driverName+ "</td> " +
                                            "   <td>" + u[i]. comMander+ "</td> " +
                                            "   <td>" + u[i]. auditLeaderShip+ "</td> " +
                                            "</tr>";
                                        $("#tab").append(s);
                                }

                                }
                            }
                        })
                });
            })

        </script>
    </head>

    <body>
        <!--<div class="x-nav">
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>-->
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5" id="form">
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input class="layui-input" placeholder="派车开始日" name="paichestartTime" id="start"></div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input class="layui-input" placeholder="派车截止日" name="paicheendTime" id="end"></div>

                            </form>
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" id="button">
                                    <i class="layui-icon">&#xe615;</i></button>
                            </div >
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" id="js-export">
                                    导出Execl表格
                                </button>
                            </div>
                        </div>
                        <div class="layui-card-body "  id="paicherecord">
                            <table class="layui-table layui-form">
                                <thead>
                                    <tr>
                                        <th>派车单号</th>
                                        <th>开单日期</th>
                                        <th>用车部门</th>
                                        <th>用车人</th>
                                        <th>用车事由</th>
                                        <th>人数</th>
                                        <th>载重</th>
                                        <th>目的地</th>
                                        <th>车牌号</th>
                                        <th>车辆类型</th>
                                        <th>驾驶人</th>
                                        <th>派车人</th>
                                        <th>审核领导</th>
                                    </tr>
                                </thead>
                                <tbody id="tab">
                                    <tr th:each="list:${lists}">
                                        <td th:text="${list.paicheno}"></td>
                                        <td th:text="${list.paichedate}"></td>
                                        <td th:text="${list.department}"></td>
                                        <td th:text="${list.useMan}"></td>
                                        <td th:text="${list.cause}"></td>
                                        <td th:text="${list.man}"></td>
                                        <td th:text="${list.weight}"></td>
                                         <td th:text="${list.destination}"></td>
                                         <td th:text="${list.carNo}"></td>
                                         <td th:text="${list.carType}"></td>
                                         <td th:text="${list.driverName}"></td>
                                         <td th:text="${list.comMander}"></td>
                                         <td th:text="${list.auditLeaderShip}"></td>
                                     </tr>
                                </tbody>
                            </table>
                        </div>
                </div>
            </div>
        </div>
    </body>
<script>
    layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start', //指定元素
                //type:'datetime', // 可选择：年、月、日、时、分、秒
                //format: 'yyyy-MM-dd HH:mm:ss', //指定时间格式
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end', //指定元素
               // type:'datetime', // 可选择：年、月、日、时、分、秒
                //format: 'yyyy-MM-dd HH:mm:ss', //指定时间格式
            });
        });
</script>
</html>
